home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / Tools / MorphOS / Epic4_mos / share / epic / script / tls < prev    next >
Encoding:
Text File  |  2002-10-28  |  6.1 KB  |  234 lines

  1. #$EPIC: tls,v 1.3 2002/08/12 16:59:49 jnelson Exp $
  2. /*
  3.  * TRACE/LINKS/STATS BEAUTIFYING SCRIPT
  4.  * This script is immortal, it just wont go away!
  5.  *
  6.  * The original author is unknown.
  7.  * TG (Daniel Cedras) picked it up, fixed it, and distribd with SuperPak
  8.  * This version was syntactically modified by Jeremy Nelson for EPIC 3
  9.  */
  10.  
  11. /*
  12.  *
  13.  * TRACE
  14.  *
  15.  * 
  16.  * For the use of /TRACE, you have the option of seeing users on a
  17.  * server or not:  <ESC>-t turns this option on and off.
  18.  * 
  19.  * It also effects the output of /STAT L
  20.  * SEEING USERS ON A SERVER IS AN OPERATOR PRIVILEGE. :p
  21.  *
  22.  */
  23. /* These special formatting aliases are courtesy of SIO and hop */
  24. alias tls.sname {
  25.     if (!(tmp = before([ $0))) {@ tmp = $0}
  26.     @ function_return = tmp
  27. }
  28.  
  29. alias tls.sip {
  30.     if (!(tmp = after([ $0))) {@ tmp = $0}
  31.     @ function_return = tmp
  32. }
  33.  
  34. alias tls.stu {
  35.     @ function_return = sar(/.undernet.org//$0)
  36. }
  37.  
  38. #Users seen by default: 
  39. #Make ESC-t the toggle combination keys
  40. @ tls.trace = [x]
  41. alias tls.tt if (tls.trace) {@ tls.trace = []} {@ tls.trace = [x]}
  42. bind ^[t parse_command tls.tt
  43.  
  44.  
  45. ###TRACEING
  46. alias TRACE {
  47.     tls.cleantr
  48.     @ tls._tn = [$0]
  49.     @ tls._tt = [Trace:$before(. $S)]
  50.     //trace $*
  51. }
  52.  
  53.  
  54. on ^server_notice *LINK* comment
  55. on ^NOTICE "*.* *LINK*" @ tls._tt = [$tls._tt-$before(. $3)]
  56.  
  57. on ^notice "*.* *OPER*" {
  58.     @ tls._tx  = [$6] ? [$6] : [$5]
  59.     if ( rmatch($before([ $tls._tx) $tls._tn) == 1 )
  60.         { tls._trace_parse $0 $tls._tx * }
  61.         { tls._trace_servb $* }
  62.     @ tls._tx = []
  63. }
  64. on ^notice "*.* *USER*" {
  65.     @ tls._tx [$6] ? [$6] : [$5]
  66.     if ( rmatch($before([ $tls._tx) $tls._tn) == 1 )
  67.         { tls._trace_parse $0 $tls._tx }
  68.         { tls._trace_servb $* }
  69.     @ tls._tx = []
  70. }
  71. on ^notice "%.% *SERV*" tls._trace_servb $*
  72.  
  73. on ^200 * {
  74.     xecho -b $before(-1 . $after(-2 . $tls.stu($0))) ==> $4
  75.     @ tls._tt = tls._tt ## [-] ## before(. $0)
  76. }
  77.  
  78. on ^204 * {
  79.     if ( rmatch($left($index([ $3)-1 $3) $tls._tn) == 1 )
  80.         { tls._trace_parse $0 $3 * }
  81.         { tls._trace_serva $* }
  82.     xecho -b $before(-1 . $after(-2 . $tls.stu($0))) $1 Class$format(5, [$2]) $format(4, 1C) ==> $left(36 $3)
  83. }
  84.  
  85. on ^205 * {
  86.     if ( rmatch($left($index([ $3)-1 $3) $tls._tn) == 1 )
  87.         { tls._trace_parse $0 $3 }
  88.         { tls._trace_serva $* }
  89.     if (tls.trace) 
  90.         {xecho -b $before(-1 . $after(-2 . $tls.stu($0))) $1 Class$format(5, [$2]) $format(4, 1C) ==> $left(36 $3)}
  91. }
  92.  
  93. on ^206 * {
  94.     tls._trace_serva $*
  95.     echo *** $[7]0 $1 Class$format(7, [$2]) $format(4, $3) $format(5, $4) ==> $tls.stu($tls.sname($5))$tls.sip($5) 
  96. }
  97.  
  98. alias _trace_servb {
  99.     if ( rmatch($0 $tls._tn) == 1 )
  100.         { echo $tls._tt-$0 }
  101.     @ tls._tt = []
  102.     @ tls._tr = []
  103.     @ tls._tn = [qwertyuipoadfg]
  104.     echo $1-3 $5-
  105. }
  106. alias _trace_serva {
  107.     if ( rmatch($0 $tls._tn) == 1 )
  108.         { echo $tls._tt-$0 }
  109.     @ tls._tt = []
  110.     @ tls._tr = []
  111.     @ tls._tn = [qwertyuiopzxc]
  112. }
  113. alias _trace_parse {
  114.     @ tls._tr = [-] ## before([ $1)
  115.     echo $tls._tt-$0$tls._tr$2
  116.     @ tls._tn = [qwertuipzxc]
  117.     @ tls._tr = []
  118.     @ tls._tt = []
  119. }
  120.  
  121. ############
  122. # Stores the output of a trace for use with conall
  123.  
  124. ^alias storetrace {
  125.     if (index([ $0) > -1) 
  126.         {@ trace.$encode($0) = before([ $0)}
  127.         {@ trace.$encode($0) = $0}
  128. }
  129.  
  130. ^alias tls.cleantr foreach trace ii { @ trace[$ii] = []}
  131.  
  132. # connect to all the servers listed in the last trace
  133. # good for when you restart the server.
  134. ^alias conall foreach trace ii { connect $trace[$ii] }
  135.  
  136. ^alias format {
  137.     @ IRCII.word = [$1-]
  138.     if (@IRCII.word < [$0]) 
  139.         { @ function_return = [$([-$0]IRCII.word)] } 
  140.         { @ function_return = [$IRCII.word] } 
  141. }
  142. ^alias lformat {
  143.     @ IRCII.word = [$1-]
  144.     if (@IRCII.word < [$0]) 
  145.         { @ function_return = [$([$0]IRCII.word)] } 
  146.         { @ function_return = [$IRCII.word] } 
  147. }
  148.  
  149.  
  150. # Trace information (extras')
  151. # -----------------
  152. # define RPL_TRACECONNECTING  201
  153. ^on ^201 * echo *** $[7]0 $1 Class$format(7, [$2]) trying...  ==> $[30]3-
  154.  
  155. # define RPL_TRACEHANDSHAKE   202
  156. ^on ^202 * echo *** $[7]0 $1 Class$format(7, [$2]) handshake  ==> $[30]3-
  157.  
  158. # define RPL_TRACEUNKNOWN     203
  159. ^on ^203 * echo *** $[7]0 $1 Class$format(7, [$2]) *unknown*  ==> $[30]3-
  160.  
  161. # define RPL_TRACESERVICE     207
  162. ^on ^207 * echo *** $[7]0 $1 Class[$format(7, $2)] service    ==> $[30]3-
  163.  
  164. # define RPL_TRACENEWTYPE     208
  165. ^on ^208 * echo *** $[7]0 $1 Class[$format(7, $2)] newtype    ==> $[30]3-
  166.  
  167. # define RPL_TRACECLASS       209
  168. ^on ^209 * echo *** $[7]0 -==- $1$format(7, [$2]) Entries linked: $3
  169.  
  170.  
  171.  
  172. ################################
  173. # STATS 
  174. ################################
  175. # Stats information
  176. # -----------------
  177.  
  178. # define RPL_STATSLINKINFO    211
  179. ^on ^211 * ^echo *** $tls.stu($[40]1) $tls.stu($left(19 $7-));echo *** $[10]2 $[10]3 $[10]4 $[10]5 $[7]6
  180. ^on ^211 "% *.*[*.*] *" $tls.stu($[40]1) $tls.stu($left(19 $7-));echo *** $[10]2 $[10]3 $[10]4 $[10]5 $[7]6
  181. ^on ^211 "% *[*" if (trace) {^echo *** $tls.stu($[40]1) $tls.stu($left(19 $7-));echo *** $[10]2 $[10]3 $[10]4 $[10]5 $[7]6}
  182.  
  183. # define RPL_STATSCOMMANDS    212
  184. ^on ^212 * ^echo *** $[7]0 $[10]1 :  $[-10]2 times 
  185.  
  186. # define RPL_STATSCLINE       213
  187. ^on ^213 * ^echo *** $[7]0 $1: $tls.stu($[25]2):$3:$tls.stu($[40]4):$5:$6-
  188.  
  189. # define RPL_STATSNLINE       214
  190. ^on ^214 * ^echo *** $[7]0 $1: $tls.stu($[25]2):$3:$tls.stu($[40]4):$5:$6-
  191.  
  192. # define RPL_STATSILINE       215
  193. #^on ^215 * ^echo *** $[7]0 $1: $[25]2:$3: $[25]4:$5:$6-
  194.  
  195. # define RPL_STATSKLINE       216
  196. #^on ^216 * ^echo *** $[7]0 $1: $[25]2:$3: $[25]4:$5:$6-
  197.  
  198. # define RPL_STATSQLINE      217
  199. #^on ^217 * ^echo *** $[7]0 $1: $[25]2:$3: $[25]4:$5:$6-
  200.  
  201. # define RPL_STATSYLINE      218
  202. ^on ^218 * ^echo *** $[7]0 $1:$[5]2:$[5]3:$[5]4:$[5]5:$6-
  203.  
  204. # Return information on
  205. # host masks being enforced locally.
  206. #
  207. ^on ^220 * ^echo *** $[7]0 $1: $[25]2:$3: $[25]4:$5:$6-
  208.  
  209. # User Mode (2.1.5 actually knows about this. This is for 2.1.4e)
  210. # define RPL_UMODEIS          221
  211. ^on ^221 * ^echo *** Your user mode is $1
  212.  
  213. # Service list:
  214. ^on ^231 * ^echo  $[7]0 Service $1 ($0)
  215.  
  216.  
  217. ########################################
  218. # LINKS
  219. ########################################
  220. alias links {
  221.     @ lcounter = 1
  222.     echo ***  No.   Class             Server                       Link
  223.     stack push on 364
  224.     ^on ^364 * {
  225.         echo *** \[$[-3]lcounter\]  \[$[-3]3\]  \[$[-25]tls.stu($1)\] <-> \[$tls.stu($2)\]
  226.         @ lcounter++
  227.     }
  228.     //links $0
  229.     wait
  230.     stack pop on 364
  231. }
  232.  
  233. ###########END OF STATS/LINKS/TRACE BEAUTIFIER
  234.